﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Wedo.Mvc.Utility;
using Wedo.Recognition.Domain.Models;
using Wedo.Recognition.Domain;
using Wedo.Recognition.Service.Service;
namespace Wedo.IPRP.Web.Controllers
{
    public class CustomerController : BaseController
    {
        public CustomerController()
        {
            //EFDbContext dbContext = new EFDbContext();
            service = new CustomerService();
        }
        private CustomerService service;

 
        ////[HttpPost]
        //public ActionResult CustomerList(string customerCode, string customerName)
        //{
        //    var list = service.GetCustomerList(customerCode, customerName);
        //    return ReturnAjaxView(list);
        //}

        //public ActionResult CustomerList(string customerCode, string customerName)
        //{
        //    var list = service.GetCustomerList(customerCode, customerName);
        //    return ReturnAjaxView(list);
        //}

        public ActionResult GetCustomer(string keyword)
        {
            return SearchCustomer(keyword);
        }

        public ActionResult SearchCustomer(string keyword)
        {
            var list = service.GetCustomerList(keyword);

            return ReturnAjaxView(list);
        }

        //修改于2012-2-7
        [HttpPost]
        public JsonResult GetCustomCodeList()
        {

            var list = service.GetCustomerCodelist();
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        [HttpPost]
        public string GetCustomNameByCode(string customerCode)
        {
            return service.GetCustomNameByCode(customerCode);
        }

    }
}
